﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PSE.Framework.Communication.Adapters
{
    /// <summary>
    /// Exceção que contém informações sobre o adapter
    /// </summary>
    public class AdapterException : CommunicationProcessException
    {
        /// <summary>
        /// Construtor padrão
        /// </summary>
        public AdapterException()
            : base()
        { 
        }

        /// <summary>
        /// Construtor que preenche Message, Process e AdapterDirection
        /// </summary>
        /// <param name="message">Mensagem de erro</param>
        /// <param name="process">Nome do processo</param>
        /// <param name="adapterDirection">Direção do adapter</param>
        public AdapterException(string message, string process, AdapterDirection adapterDirection)
            : base(message, process)
        {
            _adapterDirection = adapterDirection;
        }

        /// <summary>
        /// Construtor que preenche Message, Process, AdapterDirection e InnerException
        /// </summary>
        /// <param name="message">Mensagem de erro</param>
        /// <param name="process">Nome do processo</param>
        /// <param name="adapterDirection">Direção do adapter</param>
        /// <param name="innerException">Exception original</param>
        public AdapterException(string message, string process, AdapterDirection adapterDirection, Exception innerException)
            : base(message, process, innerException)
        {
            _adapterDirection = adapterDirection;
        }

        private AdapterDirection? _adapterDirection = null;
        /// <summary>
        /// Direção do adapter
        /// </summary>
        public AdapterDirection? AdapterDirection
        {
            get { return _adapterDirection; }
        }
    }

    /// <summary>
    /// Direção do adapter
    /// </summary>
    public enum AdapterDirection
    { 
        Input,
        Output,
        InputOutput
    }
}
